//
//  UIButton+Extension.swift
//  SinaWeibo
//
//  Created by yang on 15/11/12.
//  Copyright © 2015年 yang. All rights reserved.
//

import UIKit

extension UIButton{
    convenience init(title:String?,backImage:String?,color:UIColor?,image:String = "",size:CGFloat = 14){
        self.init()
        setTitle(title, forState:.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(size)
        if image != ""{
         setImage(UIImage(named: image), forState: .Normal)
        }
        if backImage != nil{
           
            setBackgroundImage(UIImage(named: backImage!), forState: .Normal)
            setBackgroundImage(UIImage(named: backImage!+"_highlighted"), forState:.Highlighted)
        }
        if color != nil {
            setTitleColor(color, forState: .Normal)
        }
    }
}
